package com.yz.learn.controller;

import com.yz.learn.entity.Item;
import com.yz.learn.service.StorageService;
import com.yz.learn.utils.DataResult;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
public class StorageController {
    @Autowired
    private StorageService storageService;

    @GetMapping("/api/Storages")
    public DataResult<List<Item>> getStorage() throws IOException, InvalidFormatException {
        return DataResult.success(storageService.getAllStorage());
    }
}
